package com.easemob.server.comm;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * PropertiesUtils
 *
 * @author Lynch 2014-09-15
 *
 */
public class PropertiesUtils {

	private static Properties p;
	private static String env;

	static {
		Properties runtime = new Properties();

		try {
			InputStream inputStream = PropertiesUtils.class.getClassLoader().getResourceAsStream(
					"runTimeSetting.properties");

			runtime.load(inputStream);

			env= runtime.getProperty("runTimeSetting.env");
		} catch (IOException e1) {
			e1.printStackTrace();
		}



		p = new Properties();

		try {
			InputStream inputStream = PropertiesUtils.class.getClassLoader().getResourceAsStream(
					"conf/" + env.toLowerCase() + "/IMConfig.properties");

			p.load(inputStream);

		} catch (IOException e1) {
			e1.printStackTrace();
		}
	}

	public static Properties getProperties() {

		return p;
	}

}
